package com.winderinfo.yikaotianxia.ui.order;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.winderinfo.yikaotianxia.R;
import com.winderinfo.yikaotianxia.core.base.BaseActivity;
import com.winderinfo.yikaotianxia.core.utils.PageAdapterUtil;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

public class OrderActivity extends BaseActivity {
    @BindView(R.id.ord_tab)
    TabLayout ordTab;
    @BindView(R.id.ord_pager)
    ViewPager ordPager;

    @Override
    protected int initLayoutId() {
        return R.layout.activity_myorder;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {
        List<String> list = new ArrayList<>();
        list.add("全部");
        list.add("待发货");
        list.add("待收货");
        list.add("已完成");
        // list.add("待评价");
        List<Fragment> fragments = new ArrayList<>();
        WholeFragment wholeFragment = new WholeFragment();
        DeliveryFragment deliveryFragment = new DeliveryFragment();
        ShippedFragment shippedFragment = new ShippedFragment();
        CompleteFragment completeFragment = new CompleteFragment();
        fragments.add(wholeFragment);
        fragments.add(deliveryFragment);
        fragments.add(shippedFragment);
        fragments.add(completeFragment);
        PageAdapterUtil pageAdapterUtil = new PageAdapterUtil(getSupportFragmentManager(), fragments, list);
        ordPager.setAdapter(pageAdapterUtil);
        ordTab.setupWithViewPager(ordPager);
    }

    @OnClick(R.id.ord_back)
    public void onViewClicked() {
        finish();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
